#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int arr[105][105];
int main()
{
	int x, y;
	scanf("%d%d", &x, &y);
	for (int i = 1; i <= x; i++) {
		for (int j = 1; j <= y; j++) {
			scanf("%d", &arr[i][j]);
		}
	}
	for (int i = 1; i <= y; i++) {
		for (int j = 1; j <= x; j++) {
			printf("%d ", arr[j][i]);
		}
		printf("\n");
	}
	return 0;
}